package com.balabala.gym_user.controller.app;

import com.balabala.gym_enum.ResultEnum;
import com.balabala.gym_user.pojo.dto.VenuesAppQueryDto;

import com.balabala.gym_user.service.VenuesService;
import com.balabala.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;




/**
 * @Author xh
 * @Date 2023/5/6 14:36
 */

@RestController
@RequestMapping("/app/venues")
@Slf4j
@CrossOrigin
@Api(tags = "场馆前台接口")
public class VenuesAppController {

    @Autowired
    private VenuesService venuesService;

    @GetMapping("/getVenuesPageList")
    @ApiOperation("根据场馆名称模糊查询")
    public Result getVenuesList( VenuesAppQueryDto venuesAppQueryDto){
        log.info("场馆名称模糊查询");
        return Result.ok(ResultEnum.GENERALLY_SUCCESS,venuesService.findByName(venuesAppQueryDto));
    }

    @GetMapping("/findAll")
    @ApiOperation("全部场馆查询")
    public Result  findAll(){
        log.info("全部场馆查询");
        return  Result.ok(ResultEnum.GENERALLY_SUCCESS,venuesService.findAllByVenues());
    }

    @GetMapping("/findDetails")
    @ApiOperation("场馆介绍详情页")
    public Result  findDetails(){
        log.info("查询场馆详情");
        return  Result.ok(ResultEnum.GENERALLY_SUCCESS,venuesService.findDetails());
    }

}
